
// question: 用fp.flowRight实现下述信息
// let isLastInStock = function (params) {
//     let last_car = fp.last(params)
//     // 获取最后一条数据的Name值
//     return fp.prop('name',last_car)
// }


const fp = require('lodash/fp')

const cars = [
    {name:'Audi A4L'},
    {name:'Audi A5'},
    {name:'Audi A6L'},
    {name:'Audi A7'},
    {name:'Audi A8L'},
]
function getAttr (params){

    const {data,attr} = params

    return data[attr]
}
function getData(params) {
    const {data,attr} = params
    return {
        attr,
        data:data[data.length-1],
    }
}

const t = fp.flowRight(getAttr,getData)
console.log(t({data:cars,attr:'name'}))
// A8L